package com.hzqy.service.statistics;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.hzqy.persistence.dao.statistics.OndemandDao;
import com.hzqy.persistence.dao.statistics.OrderDao;
import com.hzqy.service.core.GenericServiceBean;
import com.hzqy.web.vo.PmsUserVo;
import com.hzqy.web.vo.StatDataOndemandVo;
import com.hzqy.web.vo.UserAccountVo;
import com.hzqy.web.vo.UserBillVo;

@Service
public class OndemandServiceBean extends GenericServiceBean<PmsUserVo, OndemandDao, Integer>{
	private static final long serialVersionUID = 1L;
	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	@Resource
	private OndemandDao ondemandDao;

	@Override
	public OndemandDao getEntityDao() {
		return ondemandDao;
	}
	public Map<String,Object> selectOndemandList(StatDataOndemandVo statDataOndemandVo, int curPage,
			int pageSize) {
		Map<String,Object> map = new HashMap<String, Object>();
		Integer rowCount = ondemandDao.selectOndemandListCount(statDataOndemandVo);
		map.put("total", rowCount);
		if(rowCount > 0 && curPage > 0 && pageSize > 0) {
			map.put("firstResult", (curPage-1)*pageSize);
			map.put("maxResults", pageSize);
			map.put("f_sdo_date", statDataOndemandVo.getF_sdo_date());
			map.put("f_sdo_orgid", statDataOndemandVo.getF_sdo_orgid());
			map.put("f_sdo_orgname", statDataOndemandVo.getF_sdo_orgname());
			
			List<StatDataOndemandVo> results = ondemandDao.selectOndemandList(map);
			map.put("rows", results);
		} else {
			map.put("rows", new ArrayList<StatDataOndemandVo>());
		}
		return map;
	}
	
}
